const { contextBridge, ipcRenderer } = require('electron');

// 向渲染进程暴露有限的API
contextBridge.exposeInMainWorld('electronAPI', {
  // 调用主进程的文件选择对话框
  openFileDialog: () => ipcRenderer.invoke('open-file-dialog')
});

contextBridge.exposeInMainWorld('electronAPI', {
  openFileDialog: () => ipcRenderer.invoke('open-file-dialog'),
  // 暴露监听“加载视频”事件的方法
  onLoadVideo: (callback) => {
    ipcRenderer.on('load-video', (event, path) => callback(path));
  }
});